package com.system.weirdor.www.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.system.weirdor.common.advice.BaseController;
import com.system.weirdor.common.utills.JsonResult;
import com.system.weirdor.facade.provider.ResourceFacedeApi;
import com.system.weirdor.facade.shiro.vo.R;

import com.system.weirdor.module.entity.ResourceEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 菜单管理 前端控制器
 * </p>
 *
 * @author Weridor
 * @since 2017-08-31
 */
@RestController
@RequestMapping("/module/resource")
public class ResourceController  extends BaseController{

@Autowired
private ResourceFacedeApi resourceFacedeApi;

    /**
     * 用户菜单
     * @return
     */
    @RequestMapping(value = { "/user" }, method = { RequestMethod.GET }, produces="application/json;charset=UTF-8")
    public R user(HttpServletRequest request){
        Long id= (Long) request.getSession().getAttribute("userSessionId");
      return  resourceFacedeApi.listUserMenu(id);
    }

    /**
     * 菜单列表
     * @param params
     * @return
     */
    @RequestMapping("/list")
    public List<ResourceEntity> listMenu(@RequestParam Map<String, Object> params) {
        return resourceFacedeApi.listMenu(params);
    }
	
}
